public class Test {
    public static void fun(){
        int a=10;
        try{
            if(a==10){
                throw new NullPointerException();
            }
        }catch(NullPointerException e){
            e.printStackTrace();
            System.out.println("异常");
        }
    }
    public static void main(String[] args) {
           fun();
    }
}
